home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 35
/
PC Gamer IT CD 35 1-2.iso
/
Elink
/
NSCOMM
/
NCJS10.JAR
/
quickAdd.js
< prev
next >
Wrap
Text File
|
1997-10-20
|
3KB
|
102 lines
var container = "channel";
function handleCancel() {
self.close();
}
function handleOK(form) {
if ((form.url.value.length > 0) && (form.name.value.length > 0)) {
var oldData = opener.document.demo.findItemByName(form.name.value);
if (oldData != null) {
if (!confirm(window.depth.getLocalString("A channel with the name ") + form.name.value + window.depth.getLocalString(" already exists.")))
return;
}
var newName = opener.document.demo.getEncodedName(form.name.value, container);
if (newName == null || newName == "") {
alert("An error occurred while saving the item");
}
var prefName = "netcaster.channel." + newName;
props = opener.document.demo.newDataItem(form.url.value);
props.setPrefsKey(prefName);
props.setItemName(form.name.value);
opener.document.demo.addItem(props, container);
// opener.parent.selector.document.layers[eval(container)].fillMe();
self.close();
}
else
alert(depth.getLocalString("Please enter a valid Name and URL."));
}
function fillEdits() {
var tempName = opener.gChannelURL;
var start = tempName.lastIndexOf("/");
var end = tempName.lastIndexOf("?");
var finalName;
// after we've filled the item, for additions, make sure that we
// are allowed to add before going further.
var containerObject = opener.document.demo.findContainerByName(container);
if (containerObject != null) {
if (!containerObject.getCanAddItems()) {
alert(depth.getLocalString("addBlocked"));
self.close();
return;
}
}
if ((start > 0) && (end > 0)) {
finalName = opener.document.demo.unEncodeName(tempName.substring(start+1, end));
window.document.forms['scheduler'].name.value = finalName;
}
else {
window.document.forms['scheduler'].name.value = opener.gChannelURL;
}
window.document.forms['scheduler'].url.value = opener.gChannelURL;
}
/*
function PropertiesCallback(which) {
which.selector = opener;
which.document.layers['general'].document.scheduler.index.value = -1;
which.document.layers['general'].document.scheduler.name.value = document.scheduler.name.value;
which.document.layers['general'].document.scheduler.url.value = document.scheduler.url.value;
self.close();
}
*/
function handleLoad() {
/*
// on enter for the dialog, set the focus to the dialog
window.focus();
window.document.layers['general'].document.scheduler.name.focus();
*/
}
// These function can be called before onLoad
function suppressFalse(e) {
return false;
}
function suppressRight(e) {
if (e.which > 1)
return false;
return routeEvent(e);
}
window.ondragdrop = suppressFalse;
window.onmousedown = suppressRight;
window.onerror = depth.SupressError;
captureEvents(Event.MOUSEDOWN | Event.DRAGDROP | Event.ERROR);
void(0);